#include<bits/stdc++.h>
using namespace std;
const int N=8e3+10;
int n,q,ans[N];
struct node{
	int id,v;
	inline friend bool operator<(const node &a,const node &b){
		return a.v==b.v?a.id<b.id:a.v<b.v;
	}
}a[N],b[N];
inline int read(){
	int x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x;
}
inline void write(int x){
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	n=read(),q=read();
	for(int i=1;i<=n;i++){
		int v=read();
		a[i].id=i,a[i].v=v;
		b[i]=a[i];
	}
	sort(b+1,b+n+1);
	for(int i=1;i<=n;i++)
		ans[b[i].id]=i;
	while(q--){
		int opt=read();
		if(opt==1){
			int x=read(),v=read();
			for(int i=1;i<=n;i++)
				if(a[x]<a[i])
					ans[i]--;
			a[x].v=v;
			int tmp=0;
			for(int i=1;i<=n;i++)
				if(a[x]<a[i])
					ans[i]++;
				else
					tmp++;
			ans[x]=tmp;
		}else{
			int x=read();
			write(ans[x]),putchar('\n');
		}
	}
}
